def o(x=0): return x
def plu(x=0): return x+1


def church_plus(a, b, f=plu, x=o): return lambda *argv: b(f)(a(f)(x(*argv)))
def church_mult(a, b, f=plu, x=o): return lambda *argv: b(a(f))(x(*argv))
def church_exp(a, b, f=plu, x=o): return lambda *argv: b(a)(f)(x(*argv))


def church_num(n=0):
    def temp0(f=plu, x=o):
        def temp1(*argv):
            j = x(*argv)
            for _ in range(n):
                j = f(j)
            return j
        return temp1
    return temp0


if __name__ == "__main__":
    print(church_mult(church_num(2), church_num(5))())
    print(church_exp(church_num(2), church_num(3))())
    print(church_plus(church_num(3), church_num(2))())
